<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="Donnees.SpectacleBean"%>
<%@ page import="Donnees.RepresentationBean"%>
<%
	SpectacleBean spectacle = (SpectacleBean)request.getAttribute("spectacle");
	RepresentationBean[] listeRepresentations = (RepresentationBean[])request.getAttribute("listeRepresentations");
	int noPage = (Integer)request.getAttribute("noPage");
	int nbPages = (Integer)request.getAttribute("nbPages");
%>
<!doctype html>  
<html>
	<head>
		<title>Billetterie 525 - Liste de représentations</title>		
	</head>
	
	<!-- head -->
	<jsp:include page="head.html" />
	
	<body>
		<!--container-->
	    <div id="container">
		
		    <!-- header -->
			<jsp:include page="header.html" />
		   
			<!--body-->
			<div class="holder_content">
								    
			    <h3>SPECTACLE</h3>  
			    <ul>
			        <li>Nom de l'artiste : <%=spectacle.getArtiste()%></li>
			        <li>Nom du spectacle : <%=spectacle.getTitre()%></li>
			        <li>Prix du billet : <%=spectacle.getPrix()%>$</li>
			  	</ul>
			    
				<h3>PROCHAINES REPRÉSENTATIONS</h3>     
			    <div class="liste">
				    <table >
						<tr>
							<td>Date</td>
				            <td>Heure</td>
				            <td>Salle</td>
				        </tr>
				        <% for (int i=0; i<listeRepresentations.length;i++){%>	                 	
				            <tr onclick="location.href = 'BilletterieServlet?idSpectacle=<%=spectacle.getId()%>&idRepresentation=<%=listeRepresentations[i].getId()%>';">
					        	<td><%=listeRepresentations[i].getDate()%></td>
					            <td><%=listeRepresentations[i].getHeure()%></td>
					            <td><%=listeRepresentations[i].getSalle().getNom() + ", " + listeRepresentations[i].getSalle().getAdresse()%></td>
				        	</tr>
			            <%}%>
					</table>
			    </div>	 
			    <div class="pages">
			    	<% for (int i=1; i<=nbPages;i++){%>	                	
				    	<%if(i == noPage){%>
							<a class="currentPage"><%=i%></a>
						<%}else{%>
							<a class="otherPage" href="BilletterieServlet?idSpectacle=<%=spectacle.getId()%>&page=<%=i%>"><%=i%></a>
						<%}%>
			        <%}%>
			    </div>
			       
			</div>
		
		<!--end container-->
	    </div>
	   
		<!-- footer -->
		<jsp:include page="footer.html" />	
	     
	</body>
</html>
